/**
 * 将列表格式化为对象
 */
const listToObj = (list) => {
  const obj = {}
  for (const item of list) {
    obj[item.value] = item.label
  }
  return obj
}

// 启用禁用
export const DISABLE = [
  { label: '启用', value: 1 },
  { label: '禁用', value: 0 }
]
const DISABLE_OBJ = listToObj(DISABLE)
export const DISABLE_FN = (val) => {
  switch (val) {
  case 1:
    return `<font class="c-green">${DISABLE_OBJ[val]}</font>`
  case 0:
    return `<font class="c-red">${DISABLE_OBJ[val]}</font>`
  default:
    return DISABLE_OBJ[val]
  }
}
